/*
 * @Author: 郭招娣 10615594+guo-zhaodi@user.noreply.gitee.com
 * @Date: 2022-09-12 10:40:26
 * @LastEditors: 郭招娣 10615594+guo-zhaodi@user.noreply.gitee.com
 * @LastEditTime: 2022-09-20 15:22:17
 * @FilePath: \郭招娣\hou\app\controller\home.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
'use strict';

const Controller = require('egg').Controller;
const OSS = require('ali-oss');

let client = new OSS({
    // region以杭州为例（oss-cn-hangzhou），其他region按实际情况填写。
    region: 'oss-cn-hangzhou',
    // 阿里云账号AccessKey拥有所有API的访问权限，风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维，请登录RAM控制台创建RAM用户。
    accessKeyId: 'LTAI5tDJjRUfKVCiv36NZLkt',
    accessKeySecret: 'Czeyav1k6IBbQQWu4FTJBV3sobiYJV',
    // 填写Bucket名称。
    bucket: 'tssheng123',
});

class ClassListController extends Controller {
    // 查询全表


    async lengths() {
        const { ctx } = this;
        const lists = await this.app.mysql.select('articleLists');
        const list = await this.app.mysql.select('classLists');
        const tagList = await this.app.mysql.select('tagLists');
        const result = await client.list();
        const commentLists = await this.app.mysql.select('commentLists');
        ctx.body = {
            article: lists.length,
            classes: list.length,
            tag: tagList.length,
            file: result.objects.length,
            comment: commentLists.length,
            mag: '获取长度成功'
        }
    }






}

module.exports = ClassListController;
